RIS-assisted near-field localization using practical phase shift model

Our research focuses on examining the problem of localizing user equipment (UE) in the uplink scenario using reconfigurable intelligent surfaces (RIS) based lens. We carry out a thorough analysis of the Fisher information matrix (FIM) and assess the influence of various RIS-based lens configurations using an actual RIS phase-dependent amplitude variations model. Furthermore, to reduce the complexity of the maximum likelihood (ML) estimator, a simple localization algorithm-based angular expansion is presented. Simulation results show superior localization performance when prior location information is available for directional and positional channel configurations. The position error bound (PEB) and the root mean square error (RMSE) are studied to evaluate the localization accuracy of the user utilizing the realistic RIS phase-dependent amplitude model in the near-field region. Furthermore, the achievable data rate is obtained in the same region using the realistic RIS phase-dependent amplitude model. It is noticed that adopting the actual RIS phase-dependent amplitude model under the near-field channel increases the localization error and degrades the data rate performance for amplitude value less than one so, the unity assumption of the RIS phase shift model used widely in the literature is inaccurate.


RIS-assisted near-field localization using practical phase shift model
Saber Hassouna * , Muhammad Ali Jamshed , Masood Ur-Rehman , Muhammad Ali Imran & Qammer H. Abbasi Our research focuses on examining the problem of localizing user equipment (UE) in the uplink scenario using reconfigurable intelligent surfaces (RIS) based lens.We carry out a thorough analysis of the Fisher information matrix (FIM) and assess the influence of various RIS-based lens configurations using an actual RIS phase-dependent amplitude variations model.Furthermore, to reduce the complexity of the maximum likelihood (ML) estimator, a simple localization algorithm-based angular expansion is presented.Simulation results show superior localization performance when prior location information is available for directional and positional channel configurations.The position error bound (PEB) and the root mean square error (RMSE) are studied to evaluate the localization accuracy of the user utilizing the realistic RIS phase-dependent amplitude model in the near-field region.Furthermore, the achievable data rate is obtained in the same region using the realistic RIS phasedependent amplitude model.It is noticed that adopting the actual RIS phase-dependent amplitude model under the near-field channel increases the localization error and degrades the data rate performance for amplitude value less than one so, the unity assumption of the RIS phase shift model used widely in the literature is inaccurate.
In the realm of wireless communication networks, radio localization presents a feasible substitute for acquiring user location data within environments where global positioning system (GPS) signals are unavailable 1 .With each successive generation of mobile communication, novel features are introduced to facilitate high-speed communication, while simultaneously enhancing the precision of localization capabilities 2,3 .Radio localization techniques operate under the fundamental concept that the radio signals contain valuable information regarding the positional data of network nodes.In fourth generation (4G) systems, users make use of time-of-arrival (ToA) estimation 4 in relation to each base station (BS).This estimation relies on factors such as the distance between the user and the BS, as well as the clock bias at the user.Using ToA from at least four line-of-sight (LoS) BSs, users can calculate three-time difference of arrival (TDoA) measurements to determine their three-dimensional (3D) location.In fifth generation (5G) systems that operate in millimeter wave (mm-Wave) frequency bands, both the BS and potentially the user are equipped with multiple antennas.In this scenario, the channel is characterized by both delays and angles.The receiver determines the angle-of-arrival (AoA), while the transmitter determines the angle-of-departure (AoD).This parameterization of the channel considers both the spatial angle and the delay in the propagation of signals [5][6][7] .
The growing prevalence of applications such as smart factories, automated/assisted driving, and augmented reality has led to increasingly stringent requirements for positioning accuracy in 5G and sixth generation (6G) communication networks.In 5G, the wider bandwidth and larger antenna arrays have improved localization accuracy, making it possible to efficiently localize devices using just one BS 8,9 .Moreover, the reliability of localization provided by 5G and 6G communications is of utmost significance.As 5G and 6G systems can operate in high-frequency mm-Wave and THz bands, the links between devices are susceptible to obstacles.Since LoS propagation is typically necessary for precise location estimation, existing localization methods yield significant estimation errors if the LoS link is obstructed 10 .
Alongside their advantages for communication purposes, reflecting intelligent surfaces (RIS)s offer reliable and highly precise position estimation capabilities with low cost and high energy efficiency [11][12][13] .When the LoS link is obstructed, an RIS can establish a virtual LoS link, allowing for accurate delay measurements when utilizing wideband signals 14 .Unlike non-reconfigurable scatterers present in the environment, RISs have the ability to adjust the phase shifts of their reflecting elements, resulting in a significant beamforming gain.Additionally, RISs offer a large number of elements, further contributing to the high resolution achieved in the localization process.This capability enables RISs to provide enhanced resolution in AoA for uplink localization or AoD for downlink localization 15 .

Notations
Bold letters are used to represent vectors, while bold capital letters are used for matrices.To indicate the element in the B th row and C th column of matrix A, it is expressed as [A] B,C .The notation A B:C,K:L refers to a matrix that consists of rows from B to C and columns from K to L , taken from matrix A. The ⊙ operator denotes the Hadamard product of vectors, E{.} represents the expectation operator, and † denotes the pseudo-inverse of a matrix.The ones and zeros column vectors represent 1 N and 0 N respectively with size N. Lastly, the f(d) represents the probability density function (PDF) of a random vector d.

Geometry and signal model
We provide a detailed description of the system model utilized for localization in 3D with the help of the RIS lens.Additionally, we will introduce the near-field channel and the realistic amplitude-dependent phase model to evaluate the performance of the PEB, root mean square error (RMSE) and the achievable data rate.
We examine a wireless setup comprising of a single user transmitting from position p = [x, y, z] ⊤ , and an N-element RIS lens positioned in the XY plane with reference point [0, 0, 0] ⊤ .The RIS lens is placed near a single antenna equipped with a corresponding RF chain for reception.The antenna is located at p ant ∈ R 3 .In Fig. 1a, the system setup is depicted to present the components of the communication system, while Fig. 1b presents the 3D coordinate system that shows the positional and angular information of the user and RIS.The spacing between the horizontal and vertical elements is set to /2 where, is the wavelength of the carrier frequency.The n th element of the RIS lens is located at The ℓ n refers to the element's distance from the RIS origin to the element n and n is the n th element azimuth angle as illustrated in Fig. 1b.Each element exhibits a directivity pattern described by D(θ, ϕ) = cos 2 (ϕ) cos(θ) , where ϕ ∈ [0, 2π] represents the azimuth angle between the X-axis and the vertical projection of p on the XY plane and θ ∈ [0, π/2] represents the elevation angle between the Z-axis and the user location p. From this point forward, we will refer to the AoAs as θ and ϕ .Using the aforementioned notations, we define the wave vector k(ϕ, θ) = 2π [cos(θ) cos(ϕ), cos(θ) sin(ϕ), sin(θ)] ⊤ .To express the unknown position vector of the user, p, we can utilize the wave vector.It can be represented as p = − Qk(θ, ϕ)/2π , where Q is the Euclidean distance between p and the reference location of the RIS, denoted as Q p .Additionally, we model the prior knowledge of the user's location as a Gaussian PDF f(p).This PDF is characterized by a mean, µ p ∈ R 3 , and a covariance matrix c p ∈ R 3×3 .In the given scenario, the user transmits a narrowband signal S t over a series of T transmissions to the receive antenna through the RIS elements.The transmitted signal follows the requirements that the E |S t | 2 = E s .In general, we presume that S t = √ E s for any given transmission t.The received signal at the output of the RF receiver can be represented mathematically for each time instance t as: where, v t = diag v t,0 . . .v t,N−1 is the reflection coefficients for N RIS lens elements at time t and v t,n represents the amplitude ∈ (0, 1] and phase shift ∈ [0, 2π) for RIS element n at time t.The practical RIS phase shift model is provided next.Furthermore, ϑ = − 2πQ + ϑ sync represents the phase synchronization between the receiver and transmitter.The vector h ant ∈ C N×1 comprises the gains of the propagation channels from the RIS to the receiver.The vector Ŵ(p) ≥ 0 N represents the amplitudes of the propagation channels between the RIS elements and the transmitter while, the channel phases can be represented by the vector V(p) ∈ C N×1 .The noise vector Z t represents uncorrelated zero-mean additive Gaussian noise with a variance of N 0 /2 per real dimension.By introducing u t = v t h ant , we can define In this context, the measurement vector r = [r 1 , r 2 , . . ., r T ] ⊤ can be represented as: The model employed in signal processing literature for the localization of objects in the near-field is essentially the far-field model of electromagnetics, or a closely related approximation 29 .This work neglects the consideration of electromagnetic near-field effects within the Fraunhofer distance.In the near-field channel model, the steering vector V(p) for a specific position p is defined as: and the amplitude Ŵ(p) = Ŵ1 N is constant for all RIS elements.In the improved near-field channel model, however, the upper bound of the amplitudes Ŵ(p) can be presented as per 26 : (1) www.nature.com/scientificreports/where, the terms, is the spacing between RIS elements so each n th ele- ment of the RIS lens, with n = 1, 2, . . ., N , have the size A = × .The model described in Eq. ( 3) represents the conventional near-field model, wherein the amplitude remains unchanged, but the phase changes according to the distance from each element of the RIS.On the other hand, the model presented in Eq. ( 4) corresponds to an enhanced near-field model, as proposed in 26 .In this improved model, the element's amplitude is determined by its relative position to the location of the user, while the phase remains unchanged, as in Eq. (3).In comparison to the conventional and enhanced near-field channels, the phase in the far-field channel is given by [V(p)] n = exp −jE ⊤ n k(θ, ϕ) , while the amplitude remains unchanged for all RIS elements Ŵ(p) = Ŵ1 N .

Amplitude variations
We adopt the practical model proposed in 30 which describes the fundamental relationship between the reflection amplitude and the phase shift of the RIS.Consequently, we examine the near-field localization aided by RIS by incorporating an actual RIS amplitude model, which is based on the corresponding circuit setup of single RIS elements.In Fig. 2a, the equivalent model for the n-th reflecting element is illustrated as a parallel resonant circuit and its impedance is given by 30 : The bottom layer inductance, top layer inductance, effective capacitance, effective resistance, and carrier frequency of the incident signal are represented as I 1 , I 2 , C n , ohm n and f respectively.The reflection coefficient v t,n describes the portion of the reflected electromagnetic wave that is attributable to the discontinuity in impedance between the element impedance Z n C n , ohm n and free space impedance Z o : v t,n being a function of C n , ohm n and f, allows us to control and programme the reflected electromagnetic waves by changing the values of C n , ohm n and f.C n has values that vary from 0.15 pF to 1.5 pF, ohm n = 1 ohm, Z o = 377 , and f = 4GHz .The RIS element will scatter a sinusoidal signal impinging at frequency f with an amplitude of v t,n and a phase shift of arg v t,n .For example, in the case of a one-bit RIS, one positive-intrinsic-negative (PIN) diode is required per RIS element, and more diodes are needed for more resolution but at the cost of complex design.Consequently, the RIS is adjusted by using multiple PIN diodes numbers assigned to every element.Two alternative capacitance values can be used with each PIN diode.Figure 2b illustrates the responses of amplitude and phase for different values of capacitances.It was found that because the amplitude response and phase shifts of the reflecting element are typically non-linearly linked, they cannot be controlled separately.The reflection amplitude , as illustrated in Fig. 3, achieves a modest value at phase shift equals zero, but it grows consistently as the phase shift reaches 180 • or −180 • and asymptotically approaches one.As a consequence, it is incorrect for many earlier research to assume that the amplitude response value is one.The reflecting phase shift provided by each capacitance value varies.For instance, the capacitance values of 0.5011 pF and 0.3732 pF correspond to phases of −90 • and 90 • respectively, and will provide a 180 • phase shift spacing per element.Figure 2b shows the different values of the phase and amplitude responses with their corresponding capacitance values at center frequency f = 4 GHz.
The actual model considers variations in the amplitude, which are, in turn, determined by the phase, contrary to the commonly held assumption in the literature, which assumes a constant amplitude.More specifically, the performance loss in localization resulting from the discrepancy between the ideal and the actual model responses will be explored in this work.In the term, v t = diag v t,0 . . .v t,N−1 , let v t,n = β t,n � t,n e j� t,n where, � t,n ∈ [−π, π) is the phase shift and β t,n � t,n ∈ [0, 1] is the amplitude.The amplitude as a function of the phase can be represented as: The constants β min ≥ 0 , φ ≥ 0 , and γ ≥ 0 , are parameters associated with the particular circuit implementation being considered.It should be noted that when β min = 1 (or γ = 0 ), Eq. ( 7) is essentially the same as the ideal phase shift model with unity amplitude.Figure 4 shows the amplitude variations for different values of β min .It is evident from Fig. 4 that when β min = 1 , the amplitude response is one while, it fluctuates between zero and one when β min < 1.Using this realistic model, we have designed the RIS phase profiles for directional and positional channel models.A design of phase profile is provided next.

Design of phase profile
The accuracy of determining the user location relies on the selection of the profiles of the RIS phases v t , while the amplitudes are not assumed to be one as mentioned widely in the literature, however, they are distributed from [0, 1].To eliminate the impact of phases in the channel h ant , we assign v t = v ant ṽt , where the known phases v ant = diag u ant,0 , . . ., u ant,N−1 are chosen such that h ⊤ ant v ant n = h ⊤ ant n , ∀n 31 .Where u ant,n = (h ant /|h ant |) * n .This approach leverages the information about h ant to ensure the desired outcome.We are now left with the task of designing ṽt = diag ṽt,0 , . . ., ṽt,N−1 .We examine three configurations for ṽt,n , ∀n, t .Firstly for the random configuration, we assign ṽt,n = exp j t,n where, � t,n ∼ U(0, 2π) are indepen- dently and randomly distributed for every n th RIS element and tth time instant.Secondly, we set the directional phase configuration as ṽt,n = exp +jE ⊤ n k θ (k) , ϕ (k) .The priori PDF f(p) is used to generate the phase samples of θ (k) and ϕ (k) .Lastly, the positional phase configuration is obtained as ṽt,n = exp +j 2π p (k) − E n − Q (k) .We use the f(p) to extract the position p (k) and the distance Q (k) samples.To comprehend the difference among  www.nature.com/scientificreports/various phase profiles and demonstrate the impact of the actual phase shift model outlined in Eq. ( 7), we illustrate SNR as a function of the location for a single realization of the three phase profiles as per Fig. 5.We assume a priori position distribution with mean µ p = [−0.1,−0.1, −0.1] ⊤ ∈ R 3 and covariance c p = 0.01I 3 ∈ R 3×3 .Figure 5 shows the random, directional, and positional SNR for different values of β min = {0.1,1} .Generally, in the random scenario, we notice that the SNR remains consistent across all locations with decreased SNR near the outer edges of the RIS subject to the pathloss.However, higher SNR is attained in the selected direction [−0.1, −0.1, −0.1] ⊤ ∈ R 3 for both directional and positional cases with decreased SNR in the other areas com- pared to the random scenario.This phenomenon can be elucidated in the following manner: the directional and positional phase profiles concentrate energy toward the user's direction, resulting in a value of U ⊤ V(p) 2 ≈ 0 approximately equal to 0 for the majority of locations p that deviate from the actual user location.Consequently, tuning the RIS phase profile will improves the PEB and the localization accuracy.Furthermore, when β min = 0.1 , the SNR degrades in all three scenarios in comparison with the case of the ideal lossless model β min = 1 .The SNR dB levels at the location (-1,1.5) is shown for different values of β min for the random, directional and positional cases.The SNR can be given as follows:

Problem statement
Our objective is to develop the PEB and create a simplified algorithm for the estimation of the user position p, along with the unknown channel gain Ŵ , based on the T transmission instances and the observations r t men- tioned in Eq. (1).We assume that the practical model in Eq. ( 5) and its associated RIS parameters, β min , φ , and γ are known.In this paper, we put the assumption that these parameters are available for the case of the uplink single-user scenario when the RIS act as lens 21 .In addition to localization and unlike the widely used far-field model in the literature, we have investigated the effect of the practical phase shift model on the achievable data rate in the near-field regime taking into consideration the random, directional and positional RIS phase profiles.

Fisher information matrix (FIM) analysis
Considering the practical phase shift model in "System model", the baseband observations at the receiver for the transmitted pilots after time t in the near field regime can be rewritten using Eqs.( 1) and ( 2) as: where, u t,n = v t,n [h ant ] n = β t,n � t,n e j� t,n [h ant ] n and the amplitude β t,n � t,n is defined in (7).The model in ( 9) can be represented in a vector form.
where, U(�) = [u 1 (�) . . .u T (�)] ∈ C N×T is the matrix of the RIS profile, depending on the val- ues of the RIS amplitude circuit parameters � = [β min , φ, γ ] ⊤ in (7).Considering the noise free vector ξ = √ E s Ŵe jϑ U ⊤ (�)V(p) and the 8 × 1 vector of unknown parameters ϒ = Ŵ, ϑ, p ⊤ , β min , φ, γ ⊤ , the FIM The FIM diagonal and off-diagonal elements can be generated from the partial derivatives.However, we put the assumption that the RIS phase profile and the related amplitude circuit parameters are known at the receiver so, the 8 × 1 vector of unknown parameters ϒ = Ŵ, ϑ, p ⊤ , β min , φ, γ ⊤ can be reduced to ϒ = Ŵ, ϑ, p ⊤ ⊤ .We can represent (11) as follows: where, J Ŵ,Ŵ [J(ϒ)] 1,1 is the first diagonal element of J(ϒ) , J ϑ,ϑ [J(ϒ)] 2,2 is the second diagonal element and J p,p [J(ϒ)] 3:5,3:5 are the third, fourth and fifth diagonal elements of J(ϒ) .The off-diagonal elements above and below the main diagonal are J Ŵ,p J ϑ,p ⊤ [J(ϒ)] 1:2,3:5 and J p,Ŵ J p,ϑ [J(ϒ)] 3:5,1:2 respectively.To determine the diagonal and off-diagonal elements of the FIM J(ϒ) , we need to calculate the partial derivatives Consequently, the elements inside the FIM can be written as follows: where ℜ(.) and ℑ(.) are the real and imaginary of a complex number and the positive semidefinite matrix = U * U ⊤ .Definition 1 Equivalent FIM (EFIM): Given a parameter vector Then, the EFIM of 1 is given by Schur complement as 33,34 As per this definition, it should be noted that J 1 is the FIM of 1 under the assumption that 2 is known.Addi- tionally, J 1 2 J −1 2 J ⊤ 1 2 quantifies the amount of information lost due to the uncertainty surrounding 2 .Taking into account Definition 1, the equivalent FIM of the user position is given as: Consequently, the PEB is represented as: The RMSE of any unbiased estimator p can be bounded by an inequality:

Maximum likelihood (ML) estimation
The joint PDF can be expressed as 32,35 : where the noise free term ξ(ϒ) = G N n=1 [V(p)] n u t,n S t , G = Ŵe jϑ .Consequently, the ML estimate of the chan- nel gain and user location: Differentiating the term d(G, p) and set equal to zero, yields to the estimate that maximize the likelihood function ∂d(G,p) ∂G = 0 .Consequently, solving for G will lead to the estimate as a function of p.
Therefore, the estimate p can be computed as:

Simple user localization
The framework of the user localization problem in spherical coordinates is used to solve (22).This framework gives rise to a three-step estimation process outlined below.Initially, we represent each exponential term in the far-field, V(ϕ, θ) = e −jk(ϕ,θ) ⊤ E 1 , . . ., e −jk(ϕ,θ) ⊤ E N as [V(ϕ, θ)] n = exp −j 2π ℓ n sin(θ) cos (ϕ − � n ) .We utilize Jacobi-Anger expansion method 21 to express [V(ϕ, θ)] n as: (13) (17) PEB = trace J −1 (ϒ) 3:5,3:5 .where L > 2π ℓ max sin θ is the number of terms in the expansion that gives sufficient precision for high-quality approximation.Consequently, T ≥ T thr = 2L + 1 is adopted for low complexity solution as per Algorithm 1. Fur- thermore, J m (•) is the m-th order Bessel function of the first kind.The expansion in ( 23) can be represented as: where g n (θ) m = j m J m − 2π ℓ n sin(θ) e −jm� n and [h(ϕ)] m = e jmϕ .It can be readily confirmed that V(θ, ϕ) ≈ G ⊤ (θ)h(ϕ) , where G(θ) = g 0 (θ) . . .g N−1 (θ) .Subsequently, the response vector V(θ, ϕ) pendent structure in the angles θ and ϕ .We begin with three-stage estimating method to estimate p = p( Q, θ , φ) .We rewrite the system in (10) as: By defining the vector b as b = √ E s Gh(ϕ) based on (25), the estimation of b as a function of θ can be represented . Therefore, the estimation for the angle θ can be applied as: Using the estimated value θ , ( 23) can be rewritten as: For each value of ϕ , we estimate G in a similar manner as in ( 21), but instead of using V(p) , we substitute it with G ⊤ ( θ)h(ϕ) , resulting in the estimation Ĝ(ϕ) Therefore, we solve for ϕ: With the estimated angles θ and φ , we define p(Q) = Q sin θ cos φ sin θ sin φ cos θ ⊤ , which allows us to determine Ĝ(p(Q)) , as described in (19).Finally, we proceed to solve the optimization problem.

Now we can calculate the user estimate as:
Algorithm 1 summarizes the steps of estimating the user localization.

Computational complexity
To assess the computational complexity of Algorithm 1, consider discretizing the search intervals for distance, azimuth, and elevation into grids with a size of each 20 .We make the assumption that both and N are greater than T, which is a reasonable assumption considering the substantial size of the RIS and the need for a detailed search granularity to achieve high-quality estimates.Initially, assume that T < T thr .It is evident that the com- plexity of Algorithm 1 is primarily influenced by the 2D search process used to estimate azimuth and elevation angles.In the algorithm, it is satisfactory to focus on analyzing the computational complexity of the 2D search outlined in (22).Let us denote F (θ, ϕ) = Ĝ(p)U ⊤ V(p) so, the complexity of F (θ, ϕ) is O(TN) .The estimation problem in ( 22) is equivalent to the following problem: Consequently, following the computation of F (θ, ϕ) , a search is required over both θ and ϕ .Therefore, the overall computational cost of Algorithm 1 when T ≤ T thr is O T 2 N .When T ≥ T thr , the complexity of Algorithm 1 is primarily influenced by the estimation of θ .To estimate θ , the initial step involves computing Vol:.( 1234567890 www.nature.com/scientificreports/Subsequently, a search for θ within the range [0, π/2] is required so, the complexity will be O(TN(2L + 1)�) .
The comprehensive complexity of Algorithm 1 is expressed as O T 2 N when T ≤ T thr = 2L + 1 and O(TN(2L + 1)�) when T ≥ T thr .Consequently, it can be inferred that as T becomes sufficiently large, the adoption of the Jacobi-Anger expansion-based estimator in results in a reduction in computational complexity from O 2 to O(�) and hence converting the ac2D search problem to one-dimensional (1D) simple search line.Moreover, the decrease in complexity has not compromised accuracy, which is maintained at the decimeter level, as illustrated in Figs. 6 and 7.This observation strongly suggests the of the high-quality and optimal estimator in the algorithm.

Achievable data rate in the near field regime
Typically, the designs that aim to minimize the PEB differ from those that prioritize communication-related metrics like capacity optimization.While both types of designs exhibit improved performance in high SNR conditions, the accuracy of localization is also influenced by factors such as geometric considerations and the  www.nature.com/scientificreports/possibility of distinguishing signals from various paths rather than merely aligning them 5 .In this section of the paper, we study the performance loss on the achievable data rate in the near field channel when the realistic RIS phase profile is adopted.The achievable data rate can be represented as per 31 .
The maximum data rate is selected when the phase shifts are tuned.Recall that u t,n = v t,n [h ant ] n = β t,n � t,n e j� t,n [h ant ] n for each n th element at time instant t.As a result, at the random case, we adopt t,n = exp j t,n where � t,n ∼ U(0, 2π) , while in both directional and positional scenarios, we respectively assign the phases . The amplitude varies as β t,n =∈ (0, 1].

Simulation results
We used the simulation parameters provided in 21 but with the realistic RIS phase shift model as in "System model", so, � = [β min , φ, γ ] ⊤ .We select the range of values for β min ∈ [0, 1] and fixed the constants φ and γ to 0 and 1.5 to study the performance loss not only on the localization but also in the communication.We examine a RIS composed of N = 2500 elements arranged in N v × N h grid, where N v = N h = 50 , at a frequency of 28 GHz with /2 and 2 /4 element spacing and area, respectively.The receive antenna is positioned at coordinates [0, 0, − ] ⊤ .The transmit power, the noise power spectral density, and the reception noise figure are set to 1 mW, −174 dBm/Hz and 8 dB, respectively.The total pilot transmissions T = 200 and the bandwidth is fixed to 1 MHz.In our analysis, we focus on a user who possesses a wavevector k oriented in the direction [1, 1, 1] ⊤ .The channel gains to and from the RIS are set according to Eqs. ( 3) and ( 4).The prior knowledge about the user's location is represented by the PDF as f (p) = N p; µ p , c p , where c p = σ 2 I 3 .It is solely employed for designing the direc- tional beams of the RIS, and it is not utilized during the localization process or in the calculation of the PEB.The standard deviation in each dimension XYZ of the prior covariance of the user position is set to σ ∈ {0.1, 1} m to evaluate the localization performance in the random, directional, and optional phase profiles.In Eq. ( 21), the number of the terms in the expansion L = 5 is used for low complexity estimation.
Figures 6,7 and 8 illustrate the PEB as a function of distance in meters, number of RIS elements and SNR (dB).The figures display the PEB for the three selected designs of the RIS phase profiles, i.e., random, directional and positional, considering various values of standard deviation σ ∈ {0.1, 1} and amplitude variation β t,n =∈ (0, 1] .In Fig. 6a, it is noticed that by using a basic random phase configuration, we can achieve relatively low PEB, specifically below 1 meter, for user positions within a 10-meter distance from the RIS lens and at different values of β min .Figure 6b demonstrates the impact of varying RIS sizes on the PEB limit at different values of β min when the UE distance is 5 meters.It is evident that for all the curves under consideration for different β min , the reduction in PEB is directly proportional to N. This relationship arises from the boost in SNR in the reflected path from the RIS to the receive antenna, which is directly proportional to the RIS's different dimensional sizes N. Consequently, Fig. 6c shows the PEB performance in the low and high SNR regimes.Additionally, the absence of significant beamforming gain is attributed to the randomness of phase shifts.Figure 7 demonstrates that by employing directional or positional phase profiles ( σ = 1 and β t,n =∈ (0, 1] ), it is possible to significantly decrease the PEB.The positional phase profile exhibits slightly superior performance compared to the directional phase profile, although the disparity between the two is negligible.Similarly, in Fig. 7a, we observe that employing directional or positional phase profile allows us to achieve relatively enhanced PEB, specifically below 1 meter, for user positioned within a 10-meter range from the RIS lens, regardless of the value of β min .Figure 7b illustrates how the PEB limit is affected by varying RIS sizes at different β min values when the distance between the user and ( 33) the RIS is 5 meters.It is clear that for all the plotted curves corresponding to different β min values, the reduction in PEB is directly proportional to N. This correlation stems from the boost in SNR in the reflected path, which is directly proportional to N, as depicted in Fig. 7c.Moreover, the substantial beamforming gain is ascribed to the directional and positional phase shifts directed towards the user's location.Furthermore, the positional and directional phase profiles in Fig. 7 exhibit superior PEB performance compared to the random phase profile in Fig. 6 because of the tuned RIS coefficients that help the direct and the reflecting channel to be superimposed more constructively at the receive antenna.Similar to Figs. 7, 8 studies the PEB against distance from RIS, RIS different sizes and finally the SNR regimes but for a smaller value of standard deviation σ .Consequently, it is evident that having more precise a priori information (i.e., a smaller value for σ = 0.1 ) results in improved PEB.For example, the PEB in Fig. 8a for the positional case, σ = 0.1 and β min = 1 at distance 6 m is 0.017 m how- ever, the corresponding value in Fig. 7a at the same distance is 0.03 m.Furthermore, the PEB in Fig. 8b for the positional case, σ = 0.1 and β min = 1 at RIS number of elements 1600 is 0.007 m while its corresponding value in Fig. 7b is 0.018 m. the same study can be compared between Fig. 8c and Fig. 7c for the SNR scenario.The PEB is 0.101 at 10 dB when the standard deviation σ = 1 , while it is 0.06 when σ = 0.1 as illustrated in Figs.7c and Fig. 8c respectively.Figure 9 illustrates the RMSE of three-stage localization algorithm, plotted against the distance from the RIS in meters.We notice how the RMSE performance is affected by adopting the true RIS phase shift model considering β min = 0.5 .Due to the adoption of a definite limit of the angle and delay resolutions (360 bins for ϕ , 90 for θ , and 1000 for Q ), coupled with the limitation that the far-field presumed in the initial stages of the algorithm is not applicable for small distances, it becomes impractical to achieve the desired RMSE in the far-field regime.However, considering these factors, the performance of the positional RMSE remains far from the positional PEB, resulting in a performance that is significantly worse than what was forecasted by the bounds.This phenomenon can be justified by the following: The positional phase profiles concentrate energy towards the user's direction, resulting in the majority of locations, apart from the true location, having a value of U ⊤ V(p) 2 ≈ 0 .Conse- quently, the objective function ( 22) remains nearly consistent across various positions, displaying very slender peaks around the actual position.Due to the limited precision of the estimators, there is a high probability of missing this narrow peak, which can result in a deteriorated positional RMSE.
Figure 10 shows the data rate against the distance to the RIS.Generally, the data rate is inversely proportional with the distance, and this is due the decrease in SNR in the reflected path, which is inversely proportional to the distance from the RIS.The realistic RIS phase shift model is adopted, and the data rate performance gap is evident when β min is changed from the ideal case which is β min = 1 to the actual case which is β min = 0.2 .We notice that the achievable data rate in the positional phase profile exhibits slightly better performance than the directional phase profile, although the difference between the two is negligible.Nevertheless, both of them outperform the random phase case and this is expected since the random phase has only an aperture gain with no passive beamforming gain enhancement.
Figure 11 illustrates the achievable data rates for various phase configurations in relation to the number of RIS elements at SNR of 25 dB and a distance of 12 meters from the RIS.Our investigation focuses on assessing the impact of the amplitude-phase shift model for different β min values, specifically β min ∈ {0.2, 1} , on the achiev- able data rate.In general, we observe a decline in the achievable rate when β min < 1 Firstly, it is evident that the performance of the random phase shift approach at the RIS remains unaffected by the number of elements.This result aligns with expectations, given that random phase shifts only contribute to aperture gain without any passive beamforming gain.Secondly, it is notable that both positional and directional phase configurations exhibit superior performance compared to the scheme employing random phase shifts.As the number of elements www.nature.com/scientificreports/increases, we observe a consistent rise in achievable rates.This trend is logical, as the passive beamforming performance steadily improves with the increasing number of elements.

Conclusion
We addressed the task of localizing the user in a 3D space using a RIS-based lens with a practical phase-shift model.By leveraging the curved nature of the wavefront, it is possible to estimate the location of the user by utilizing multiple phase configurations of the RIS.Fisher information analysis offers valuable insights into the design of these phase configurations taking into consideration the actual RIS phase shift model.Additionally, we have introduced a low-complexity 3D localization algorithm that simplifies the problem by decoupling the main 3D problem into 3 1D problems using the angular expansion approach.The advantage of this work shows the realistic results when using the practical phase-dependent amplitude model.The literature is saturated with RIS-related communication and localization works with overoptimistic results and far-field assumptions so, we tried in our work to prove that considering the lossless (ideal phase shift model) is not accurate in measuring the performance of localization (such as PEB and RMSE) and communication (such as achievable data rate).
There are various potential research directions that can be explored further.One such direction involves mutual coupling and electromagnetic interference.When the RIS sections on the substrate material are in close proximity, effectively maintaining separation poses a challenge.This proximity gives rise to mutual coupling, wherein the impedance of one element becomes interconnected with the impedances of its neighboring elements.Consequently, the frequency response will vary depending on the configuration of the adjacent elements.Several researchers overlook the electromagnetic interference inevitably present in any environment, choosing instead to concentrate solely on the signals produced by the system.Electromagnetic interference can stem from various sources, including natural occurrences, intentional activities, or unintentional factors like man-made devices and  background radiation.Generally, every unregulated wireless transmission produces electromagnetic interference.The energy of electromagnetic interference waves impacting the RIS in the space in front of it is directly proportional to its surface area.When the RIS emits the absorbed electromagnetic interference energy again, it can reach the intended receiver, leading to a degradation in the SNR of wireless networks that are unaware of such interference effects.The decline in SNR is attributed to the fact that these wireless networks or systems are primarily designed to counteract only the thermal noise generated by the receiver, neglecting the impact of external electromagnetic interference.Considering mutual coupling and electromagnetic interference could provide additional accurate information and insights for proper positioning and communication.These areas offer promising opportunities for advancing localization and communication techniques and enhancing their performance in practical scenarios.

Figure 2 .
Figure 2. (a) Structure of the RIS including its reflecting element and the equivalent RLC circuit model and (b) amplitude and phase responses for different elements and their corresponding capacitance values.